using System;
using System.Net;

namespace LANamp
{
    public class Server
	{
		private string ipaddress;
        private string hostname;
		private string name;
        private string version;
        private string winampversion;
		private int lives;
		public static string ToIP(EndPoint ep)
		{
			return ep.ToString().Split(':')[0];
		}

		public Server(string IPaddress, string Name, string Hostname, string Version, string WinampVersion, int Lives)
		{
			ipaddress = IPaddress;
			name = Name;
            hostname = Hostname;
            version = Version;
            winampversion = WinampVersion;
			lives = Lives;
		}
		public string Name
		{
			get 
			{
				return name;
			}
			set
			{
				name = value;
			}
		}
        public String Hostname
        {
            get
            {
                return hostname;
            }
            set
            {
                hostname = value;
            }
        }
        public String Host
        {
            get
            {
                return (hostname != "") ? hostname.ToLower() + "  (" + ipaddress + ")" : ipaddress;
            }
        }
        public String IPaddress
		{
			get
			{
				return ipaddress;
			}
            set
            {
                if (ipaddress == "0.0.0.0") ipaddress = value;
            }
		}
        public string Version
        {
            get
            {
                return version;
            }
            set
            {
                version = value;
            }
        }
        public string WinampVersion
        {
            get
            {
                return winampversion;
            }
            set
            {
                winampversion = value;
            }
        }
        public int Lives
		{
			get
			{
				return lives;
			}
			set
			{
				lives = value;
			}
		}
	}
}
